<nav style="text-align: center" data-th-fragment="page" data-th-if="${records!=null and records.totalPages gt 0}" data-th-object="${records}"
	 xmlns:th="http://www.thymeleaf.org">
 
	<!-- 处理页数小于等于7 的情况 -->
	<ul class="pagination" data-th-if="${records.totalPages le 7}" >
		<!-- 上一页 -->
		<li class="page-item">
			<a data-th-if="${not records.first}" data-th-href="@{${url}+'?page='+${records.number}}">
				<span aria-hidden="true">«</span>
			</a>
			<a data-th-if="${records.first}"><span disabled="true" aria-hidden="true">«</span></a>
		</li>
		
		<!-- 迭代生成页码 -->
		<li class="page-item" data-th-each="i : ${#numbers.sequence(1, records.totalPages)}"
			data-th-classappend="${(records.number + 1) eq i} ? 'active' : ''" >
			<a data-th-href="@{${url}+'page='+${i}}">
                 <span data-th-text="${i}"></span>
            </a>
		</li>
		
		<!-- 下一页 -->
		<li class="page-item">
			<a data-th-if="${not records.last}" data-th-href="@{${url}+'page='+${(records.number + 2)} }">
				<span aria-hidden="true">»</span>
			</a>
			<a data-th-if="${records.last}"><span disabled="true" aria-hidden="true">»</span></a>
		</li>
	</ul>
		
	<!-- 处理页数大于7 的情况 -->	
	<ul class="pagination" data-th-if="${records.totalPages gt 7}"  >
		<!-- 上一页 -->
		<li class="page-item">
			<a data-th-if="${not records.first}" data-th-href="@{${url}+'page='+${records.number}}">
				<span aria-hidden="true">«</span>
			</a>
			<a data-th-if="${records.first}"><span disabled="true" aria-hidden="true">«</span></a>
		</li>
		
 		<!-- 首页 -->
		<li class="page-item" data-th-classappend="${(records.number + 1) eq 1} ? 'active' : ''" >
			<a data-th-href="@{${url}+'page=1'}">1</a>
		</li>
		 
		
	 	<!-- 当前页面小于等于4 -->
	 	<li class="page-item" data-th-if="${(records.number + 1) le 4}" data-th-each="i : ${#numbers.sequence(2,5)}"
			data-th-classappend="${(records.number + 1) eq i} ? 'active' : ''" >
			<a data-th-href="@{${url}+'page='+${i}}">
				<span data-th-text="${i}"></span>
			</a>
		</li>
 
		<li data-th-if="${(records.number + 1) le 4}">
			<a data-th-href="@{${url}+'page='+${(records.totalPages-records.number)/2+records.number+1}}">
				<span aria-hidden="true">...</span>
			</a>
		</li>
		
		<!-- 最后一页与当前页面之差，小于等于3 -->
		<li data-th-if="${(records.totalPages-(records.number + 1)) le 3}">
			<a data-th-href="@{${url}+'page='+${(records.number-1)/2+1}}">
				<span aria-hidden="true">...</span>
			</a>
		</li>  
	 	<li class="page-item" data-th-if="${(records.totalPages-(records.number + 1)) le 3}" data-th-each="i : ${#numbers.sequence(records.totalPages-4, records.totalPages-1)}"
			data-th-classappend="${(records.number + 1) eq i} ? 'active' : ''" >
			<a  data-th-href="@{${url}+'page='+${i}}">
                <span data-th-text="${i}"></span>
           </a>
		</li>
	 
		 <!-- 最后一页与当前页面之差大于3，且  当前页面大于4-->

		<li data-th-if="${((records.number + 1) gt 4) && ((records.totalPages-(records.number + 1)) gt 3 )}">
			<a data-th-href="@{${url}+'page='+${(records.number-1)/2+1}}">
				<span aria-hidden="true">...</span>
			</a>
		</li>
	 	<li class="page-item" data-th-if="${((records.number + 1) gt 4) && ((records.totalPages-(records.number + 1)) gt 3 )}" >
	 		<a  data-th-href="@{${url}+'page='+${records.number}}">[[${records.number}]]</a>
	 	</li>
		<li class="page-item active" data-th-if="${((records.number + 1) gt 4) && ((records.totalPages-(records.number + 1)) gt 3 )}">
			<a  data-th-href="@{${url}+'page='+${records.number + 1}}">[[${records.number + 1}]]</a>
		</li>
		<li class="page-item" data-th-if="${((records.number + 1) gt 4) && ((records.totalPages-(records.number + 1)) gt 3 )}">
			<a data-th-href="@{${url}+'page='+${records.number + 2}}" >[[${records.number + 2}]]</a>
		</li>
		
		<li data-th-if="${((records.number + 1) gt 4) && ((records.totalPages-(records.number + 1)) gt 3 )}">
			<a data-th-href="@{${url}+'page='+${(records.totalPages-records.number )/2+records.number+1}}">
				<span aria-hidden="true">...</span>
			</a>
		</li>
 
		<!-- 最后一页 -->
		<li class="page-item" data-th-classappend="${(records.number + 1) eq records.totalPages} ? 'active' : ''" >
			<a data-th-href="@{${url}+'page='+${records.totalPages}}" >[[${records.totalPages}]]</a>
		</li>

		<!-- 下一页 -->
		<li class="page-item">
			<a data-th-if="${not records.last}" data-th-href="@{${url}+'page='+${(records.number + 2)} }">
				<span aria-hidden="true">»</span>
			</a>
			<a data-th-if="${records.last}"><span disabled="true" aria-hidden="true">»</span></a>
		</li>
	</ul>
 
 
</nav>